theMat = [0.243038	-0.033987	-0.032489	0.041975	-0.146440	-0.101648
-0.014499	0.503139	0.002500	0.015999	-0.086285	0.011499
-0.003000	0.030491	0.535268	0.009000	0.053948	-0.156210
0.009500	0.008500	0.049460	0.434556	0.057437	-0.132221
-0.232660	-0.079830	0.027493	0.038980	0.466432	-0.036484
-0.120906	0.006000	-0.031490	-0.116469	-0.000500	0.283515
    ];

attitudes = {
    'Ideological Id'
    'Military Spending'
    'Welfare'
    'Immigrants'
    'Party Id'
    'Environment'
    };

irfLen = 6;
theXlabel = 'Months';
xScale = 0:(irfLen-1);

%%

irfIdeo = zeros(irfLen, 6);
irfIdeo(1, 1) = 1;
for ix = 2:irfLen
    irfIdeo(ix, :) = irfIdeo(ix-1, :) * theMat;
end

theData = irfIdeo;
setupFigure;
plot(xScale, theData(:, 1), '-', 'LineWidth',2); hold on;
plot(xScale, theData(:, 2), '--', 'LineWidth',2);
plot(xScale, theData(:, 3), '-.', 'LineWidth',2);
plot(xScale, theData(:, 4), ':', 'LineWidth',2);
plot(xScale, theData(:, 5), '-x', 'LineWidth',2);
plot(xScale, theData(:, 6), '--d', 'LineWidth',2);
legend(attitudes, 'Location','best');
finishFigure;
print(gcf, 'irf_gss_ideo.eps', '-depsc');

%%

irfMil = zeros(irfLen, 6);
irfMil(1, 2) = 1;
for ix = 2:irfLen
    irfMil(ix, :) = irfMil(ix-1, :) * theMat;
end

theData = irfMil;
setupFigure;
plot(xScale, theData(:, 1), '-', 'LineWidth',2); hold on;
plot(xScale, theData(:, 2), '--', 'LineWidth',2);
plot(xScale, theData(:, 3), '-.', 'LineWidth',2);
plot(xScale, theData(:, 4), ':', 'LineWidth',2);
plot(xScale, theData(:, 5), '-x', 'LineWidth',2);
plot(xScale, theData(:, 6), '--d', 'LineWidth',2);
legend(attitudes, 'Location','best');
finishFigure;
print(gcf, 'irf_gss_mil.eps', '-depsc');

%%

irfWelfare = zeros(irfLen, 6);
irfWelfare(1, 3) = 1;
for ix = 2:irfLen
    irfWelfare(ix, :) = irfWelfare(ix-1, :) * theMat;
end

theData = irfWelfare;
setupFigure;
plot(xScale, theData(:, 1), '-', 'LineWidth',2); hold on;
plot(xScale, theData(:, 2), '--', 'LineWidth',2);
plot(xScale, theData(:, 3), '-.', 'LineWidth',2);
plot(xScale, theData(:, 4), ':', 'LineWidth',2);
plot(xScale, theData(:, 5), '-x', 'LineWidth',2);
plot(xScale, theData(:, 6), '--d', 'LineWidth',2);
legend(attitudes, 'Location','best');
finishFigure;
print(gcf, 'irf_gss_welfare.eps', '-depsc');

%%

irfMigrants = zeros(irfLen, 6);
irfMigrants(1, 4) = 1;
for ix = 2:irfLen
    irfMigrants(ix, :) = irfMigrants(ix-1, :) * theMat;
end

theData = irfMigrants;
setupFigure;
plot(xScale, theData(:, 1), '-', 'LineWidth',2); hold on;
plot(xScale, theData(:, 2), '--', 'LineWidth',2);
plot(xScale, theData(:, 3), '-.', 'LineWidth',2);
plot(xScale, theData(:, 4), ':', 'LineWidth',2);
plot(xScale, theData(:, 5), '-x', 'LineWidth',2);
plot(xScale, theData(:, 6), '--d', 'LineWidth',2);
legend(attitudes, 'Location','best');
finishFigure;
print(gcf, 'irf_gss_migrants.eps', '-depsc');

%%

irfParty = zeros(irfLen, 6);
irfParty(1, 5) = 1;
for ix = 2:irfLen
    irfParty(ix, :) = irfParty(ix-1, :) * theMat;
end

theData = irfParty;
setupFigure;
plot(xScale, theData(:, 1), '-', 'LineWidth',2); hold on;
plot(xScale, theData(:, 2), '--', 'LineWidth',2);
plot(xScale, theData(:, 3), '-.', 'LineWidth',2);
plot(xScale, theData(:, 4), ':', 'LineWidth',2);
plot(xScale, theData(:, 5), '-x', 'LineWidth',2);
plot(xScale, theData(:, 6), '--d', 'LineWidth',2);
legend(attitudes, 'Location','best');
finishFigure;
print(gcf, 'irf_gss_party.eps', '-depsc');

%%

irfEnv = zeros(irfLen, 6);
irfEnv(1, 6) = 1;
for ix = 2:irfLen
    irfEnv(ix, :) = irfEnv(ix-1, :) * theMat;
end

theData = irfEnv;
setupFigure;
plot(xScale, theData(:, 1), '-', 'LineWidth',2); hold on;
plot(xScale, theData(:, 2), '--', 'LineWidth',2);
plot(xScale, theData(:, 3), '-.', 'LineWidth',2);
plot(xScale, theData(:, 4), ':', 'LineWidth',2);
plot(xScale, theData(:, 5), '-x', 'LineWidth',2);
plot(xScale, theData(:, 6), '--d', 'LineWidth',2);
legend(attitudes, 'Location','best');
finishFigure;
print(gcf, 'irf_gss_env.eps', '-depsc');
